﻿using System;
using System.Collections.Generic;
using System.Linq;

namespace SARS.Entity
{
    public class GroupEntity
    {
        public Int32 GroupID { get; set; }
        public string GroupName { get; set; }
        public Int32 CourseID { get; set; }

        public virtual CourseEntity Course { get; set; }

        public virtual ICollection<StudentEntity> GroupMembers { get; set; }

        public virtual ICollection<TutorEntity> GroupTutorial { get; set; }

        public virtual string GroupTutorialNames
        {
            get
            {
                if (GroupTutorial == null || GroupTutorial.Count == 0)
                {
                    return string.Empty;
                }
                string temp = GroupTutorial.Aggregate("", (current, tutor) => current + (tutor.FullName + "; "));

                return temp.Substring(0, temp.Length - 2);
            }
        }
    }
}